package com.sw.fileServer.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xly
 * @date 2021-12-07 2:14 下午
 **/
@Configuration
public class MinioClientConfig {

    //文件服务器地址
    @Value("${fileServer.fileServerUrl}")
    private String fileServerUrl;

    @Value("${fileServer.accessKey}")
    private String accessKey;

    @Value("${fileServer.secretKey}")
    private String secretKey;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder().endpoint(fileServerUrl).credentials(accessKey, secretKey).build();
    }
}
